<php>
	$this->display(tpl('head'));
	$type[$group['type']]="checked";
	$if_admin[$group['if_login_admin']]="checked";
	$Article_yz[$setting['Article_yz']]="checked";
	$comment_yz[$setting['comment_yz']]="checked";
	$comment_yzm[$setting['comment_yzm']]="checked";
	$comment_add[$setting['comment_add']]="checked";
	$if_login_user[$group['if_login_user']]="checked";
	if($group['if_login_admin']==0){
		$if_login_admin_display=" style='display:none'";
	}
</php>
<style>
		.layui-tab{
				padding-left: 20px;
		}
		.layui-form-select {
		    position: relative;
		    width: 30%;
		}
		.layui-input-my {
		    display: block;
		    width: 30%;
		    padding-left: 10px;
		}
		.layui-form-label {
		    float: left;
		    display: block;
		    padding: 9px 15px;
		    width: 150px;
		    font-weight: 400;
		    text-align: right;
		}
		.layui-form-select{
			display: none;
		}
		.layui-form select {
		    display:  initial;
		    width: 30%;
		}
		.layui-form-checkbox{
			margin-bottom: 5px;
			margin-top: 5px;
		}
		.names{
			font-weight: bold;
			font-size: 16px;
		}
</style>
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
  	<legend>用户组属性修改</legend>
</fieldset>
<form  class="layui-form" method="post">
	<table class="layui-table my-tabel">
		<tr>
			<td>用户组名称</td>
			<td>
				<input name="name" value="{{$group['name'] }}" class="layui-input layui-input-my" type="text" >
			</td>
		</tr>
		<tr>
			<td>用户组类型</td>
			<td>
				<input name="type" value="0" lay-filter="type" title="系统组" type="radio" {{$type[0] }}>
		   		<input name="type" value="1" lay-filter="type" title="会员组" type="radio" {{$type[1] }}>
			</td>
		</tr>
		<tr>
			<td>是否允许登录后台</td>
			<td>
				<input name="if_login_admin" value="1" lay-filter="if_login_admin" title="允许" type="radio" {{$if_admin[1] }}>
		   		<input name="if_login_admin" value="0" lay-filter="if_login_admin" title="不允许" type="radio" {{$if_admin[0] }}>
			</td>
		</tr>
		<tr>
			<td>是否禁止登录会员中心</td>
			<td>
				<input name="if_login_user" value="1" lay-filter="if_login_user" title="允许" type="radio" {{$if_login_user[1] }}>
		   		<input name="if_login_user" value="0" lay-filter="if_login_user" title="不允许" type="radio" {{$if_login_user[0] }}>
			</td>
		</tr>
		<tr id="if_login_admin_display" {{$if_login_admin_display }}>
			<td>给予后台权限</td>
			<td>
				<table class="layui-table">
					<tr>
						<td colspan="2" class="names">主权限</td>
					</tr>
					<tr>
						<td>允许登入后台必须的权限</td>
						<td>
							<input type="checkbox" name="setting[power][index][]" value="index" title="后台首页" checked>
					 		<input type="checkbox" name="setting[power][index][]" value="map" title="map页面" checked>
					 		<input type="checkbox" name="setting[power][index][]" value="login" title="登入页面" checked>
					 		<input type="checkbox" name="setting[power][index][]" value="out" title="退出后台" checked><br>
					 		<input type="checkbox" name="setting[power][index][]" value="modular" title="如果需要授权其他模块管理权限，必选" checked>
					 		<input type="checkbox" name="setting[power][index][]" value="plugin" title="如果需要授权插件管理权限，必选" checked>
						</td>
					</tr>
					<foreach array="C('POWER')" f="1" key="action">
					<tr>
						<td>{{$row['name'] }}</td>
						<td>
							<foreach array="row['power']" key="job" value="r">
							<php>
								$checked= in_array($job, (array)$setting['power'][$action]) ? 'checked' : '';
							</php>
					 		<input type="checkbox" name="setting[power][{{$action }}][]" value="{{$job }}" title="{{$r['name'] }}" {{$checked }}>
							</foreach>
						</td>
					</tr>
					</foreach>

				</table>
				<foreach array="Modular_DB" key="action">
				<table class="layui-table">
					<tr>
						<td colspan="2" class="names">{{$row['name'] }}权限设置</td>
					</tr>
					<foreach array="row['POWER']" key="action" value="rows">
					<tr>
						<td>{{$rows['name'] }}</td>
						<td>
							<foreach array="$rows['power']" key="job" value="r">
							<php>
							
								$checked= in_array($job,(array)$setting['power'][$row['table'].'power'][$action]) ? 'checked' : '';
								
							</php>
	 						<input type="checkbox" name="setting[power][{{$row['table'] }}power][{{$action}}][] " value="{{$job }}" title="{{$r['name'] }}" {{$checked }}>
							</foreach>
						</td>
					</tr>
					</foreach>
				</table>
				</foreach>
				<table class="layui-table">
					<tr>
						<td class="names">插件权限</td>
					</tr>
					<tr>
						<td>
							<foreach array="plugin_DB" key="action">
							<table class="layui-table">
								<tr>
									<td colspan="2" class="names">{{$row['name'] }}权限设置</td>
								</tr>
								<foreach array="row['POWER']" key="action" value="rows">
								<tr>
									<td>{{$rows['name'] }}</td>
									<td>
										<foreach array="rows['power']" key="job" value="r">
										<php>
										
											$checked= in_array($job,(array)$setting['power'][$row['table'].'power'][$action]) ? 'checked' : '';
											
										</php> 
				 						<input type="checkbox" name="setting[power][{{$row['table'] }}power][{{$action}}][] " value="{{$job }}" title="{{$r['name'] }}" {{$checked }}>
										</foreach>
									</td>
								</tr>
								</foreach>
							</table>
							</foreach>
						</td>
					</tr>
				</table>
			</td>
		</tr>
		<tr>
			<td>允许上传文件的类型</td>
			<td>
				<input name="setting[upfiles_type]"  class="layui-input layui-input-my" type="text" value="{{$setting['upfiles_type'] }}">
			</td>
		</tr>
		
		<tr>
			<td colspan="2" class="my_button">
				<input type="hidden" name="id" value="{{$id }}" />
				<input type="hidden" name="step" id="step" value="edit" />
				<button class="layui-btn">提交</button>
			</td>
		</tr>
	</table>
</form>
<script>
	layui.use(['form'], function(){
	  	var form = layui.form;
	  	form.on('radio(if_login_admin)', function(data){
	  		if(data.value==1){
	  			document.getElementById("if_login_admin_display").style.display="";
	  		}else{
	  			document.getElementById("if_login_admin_display").style.display="none";
	  		}
	  	})
	});
</script>
<php> $this->display(tpl('foot')); </php>
